package game.view.miui
{
	import fl.controls.Button;
	
	import flash.events.MouseEvent;
	
	import game.define.NotificationNames;
	import game.manager.LayerManager;
	import game.view.test.TestMediator;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	public class MainUIMediator extends Mediator
	{
		public static const NAME:String = "MainUIMediator";
		
		public function MainUIMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(NAME, new MainUIView());
			
			LayerManager.mainUILayer.addChild(view);
			
			var btnTest:Button = new Button();
			btnTest.move(300, 10);
			btnTest.label = "test";
			view.addChild(btnTest);
			btnTest.addEventListener(MouseEvent.CLICK, function():void{TestMediator.instance.show()});
		}
		
		private function get view():MainUIView
		{
			return viewComponent as MainUIView;
		}
		
		override public function listNotificationInterests():Array
		{
			return [
				NotificationNames.PLAYER_BASE_DATA_CHANGED
			];
		}
		
		override public function handleNotification(notification:INotification):void
		{
			switch (notification.getName())
			{
				case NotificationNames.PLAYER_BASE_DATA_CHANGED:
					
					break;
			}
		}
	}
}